// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1
import "../Components"

AndroidItem {
    id: _root
    width: 720 * viewScale
    height: 96 * viewScale
    clip: true
    color: "#000000"

    property string naviKeyBackPath: ""         //ナビキー（戻る）
    property string naviKeyExpandPath: ""       //ナビキー（ノティファイ開く）
    property string naviKeyHomePath: ""         //ナビキー（ホーム）
    property string naviKeyMenuPath: ""         //ナビキー（メニュー）
    property string naviKeyRecentPath: ""       //ナビキー（履歴）

    property real keyWidth: 144 * viewScale
    property real keyHeight: 96 * viewScale

    signal clicked(int key)


    Row{
        opacity: _root.isLock ? 0.001 : 1.0
        ImageButton{
            width: keyWidth
            height: keyHeight
            clip: true
            fillMode: Image.PreserveAspectFit
            imageIdle: _root.naviKeyBackPath
            imagePress: _root.naviKeyBackPath
            onClicked: _root.clicked(1);
            onPressed: _root.press(x);
            onReleased: _root.release();
        }
        ImageButton{
            width: keyWidth
            height: keyHeight
            clip: true
            fillMode: Image.PreserveAspectFit
            imageIdle: _root.naviKeyMenuPath
            imagePress: _root.naviKeyMenuPath
            onClicked: _root.clicked(2);
            onPressed: _root.press(x);
            onReleased: _root.release();
        }
        ImageButton{
            width: keyWidth
            height: keyHeight
            clip: true
            fillMode: Image.PreserveAspectFit
            imageIdle: _root.naviKeyHomePath
            imagePress: _root.naviKeyHomePath
            onClicked: _root.clicked(3);
            onPressed: _root.press(x);
            onReleased: _root.release();
        }
        ImageButton{
            width: keyWidth
            height: keyHeight
            clip: true
            fillMode: Image.PreserveAspectFit
            imageIdle: _root.naviKeyExpandPath
            imagePress: _root.naviKeyExpandPath
            onClicked: _root.clicked(4);
            onPressed: _root.press(x);
            onReleased: _root.release();
        }
        ImageButton{
            width: keyWidth
            height: keyHeight
            clip: true
            fillMode: Image.PreserveAspectFit
            imageIdle: _root.naviKeyRecentPath
            imagePress: _root.naviKeyRecentPath
            onClicked: _root.clicked(5);
            onPressed: _root.press(x);
            onReleased: _root.release();
        }
    }

    function press(x){
        _btnPress.x = x - keyWidth * 0.1;
        _btnPress.visible = true;
    }
    function release(){
        _btnPress.visible = false;
    }

    Rectangle{
        id: _btnPress
        x: _root.width / 2 - width / 2
        y: _root.height / 2 - height / 2
        width: keyWidth * 1.2
        height: width
        radius: width / 2
        visible: false
        opacity: 0.6
        color: "#33aadd"
    }
}
